<template>
	<view>
		<view class="header" :class="bg?'bg-theme':''"></view>
		<view  class="flex f-a-c j-s-b tit">
			<i v-if="back" class="icon iconfont icon-right t-r90" :class="bg?'color-w':''" @click.stop="goback"></i>
			<text v-if="name" :class="bg?'color-w f17 fw5':'f20 fw'" >{{name}}</text>
			<i v-if="right" class="icon iconfont icon-next f22" :class="bg?'color-w':''" @click.stop="scanCode"></i>
		</view>
		<view class="scan" v-if="scanModel">
			<view class="bg"></view>
			<view class="cont">
				<view>您是否要退出账号？</view>
				<view class="flex f-a-c j-s-b">
					<text @click.stop="scanCode(1)" class="btn bg-theme color-w">确定</text>
					<text @click.stop="scanCode" class="btn">取消</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
  name:'topTitle',
  props:{
    name:{
      type: String,
      default: ''
    },
    back:{
		  type: Boolean,
		  default: false
    },
    right:{
		  type: Boolean,
		  default: false
    },
		bg:{
			type: Boolean,
			default: false
		},
		size:{
			type: [String,Number],
			default: ''
		}
  },
  data() {
    return {
			scanModel: false
    };
  },
	onLoad(op) {
		
	},
	methods:{
		scanCode(type){
			console.log(type,565);
			if(type == 1){
				uni.reLaunch({
					url:'/pages/login/index'
				})
				uni.removeStorageSync('userInfo')
				this.util.req(this.api.apiLogout,{}).then(res=>{})
			}else{
				this.scanModel = !this.scanModel;
			}
		},
		goback(){
			uni.navigateBack(1)
		}
	}
}
</script>

<style lang="less">
	.header{
		height: 88rpx;
		line-height: 88rpx;
		width: 100%;
		background: #fff;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.tit{
		padding: 0 32rpx 32rpx 32rpx;
	}
	.scan{
		.bg{
			background: #00000060;
			position: fixed;
			width: 100%;
			height: 100%;
			z-index: 1;
			top:0;
			left: 0;
			right: 0;
			bottom: 0;
		}
		.cont{
			width: 568rpx;
			height: 298rpx;
			background: #FFFFFF;
			border-radius: 16rpx;
			z-index: 2;
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			top: 0;
			margin: auto;
			text-align: center;
			display: flex;
			justify-content: space-between;
			flex-direction: column;
			padding: 74rpx 46rpx 52rpx;
			box-sizing: border-box;
			.btn{
				width: 228rpx;
				height: 76rpx;
				line-height: 76rpx;
				background: #E9E9E9;
				border-radius: 8rpx;
				margin-top: 48rpx;
			}
		}
	}
</style>